<template>
  <div class="modal-overlay" v-if="visible">
    <div class="modal-content confirm-modal">
      <div class="modal-header">
        <div class="modal-icon text-warning">
          <i class="fas fa-exclamation-triangle"></i>
        </div>
        <h2 class="modal-title">确认跳过问卷？</h2>
        <button type="button" class="btn-close" @click="cancelSkip">
          <i class="fas fa-times"></i>
        </button>
      </div>
      <div class="modal-body">
        <p>跳过问卷后，相关记录将被保存到系统，医生可能无法提前了解您的健康状况。</p>
        <p class="text-warning">是否确定要跳过健康问卷？</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-outline" @click="cancelSkip">
          <i class="fas fa-arrow-left"></i> 返回填写
        </button>
        <button type="button" class="btn btn-warning" @click="confirmSkip">
          <i class="fas fa-check"></i> 确认跳过
        </button>
      </div>
    </div>
  </div>
</template>

<script setup>
const props = defineProps({
  visible: {
    type: Boolean,
    required: true
  }
})

const emit = defineEmits(['confirm', 'cancel'])

const confirmSkip = () => {
  emit('confirm')
}

const cancelSkip = () => {
  emit('cancel')
}
</script>

<style scoped>
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background-color: white;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 100%;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  padding: 25px;
  border-bottom: 2px solid #f0f0f0;
  position: relative;
}

.modal-icon {
  font-size: 28px;
  color: #f39c12;
  margin-right: 15px;
}

.text-warning {
  color: #f39c12;
  font-weight: bold;
}

.modal-title {
  font-size: 24px;
  font-weight: 700;
  color: #2980b9;
  margin: 0;
  flex: 1;
}

.btn-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #777;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  border-radius: 50%;
  width: 40px;
  height: 40px;
}

.btn-close:hover {
  color: #333;
  background-color: #f0f0f0;
  transform: scale(1.1);
}

.modal-body {
  padding: 25px;
}

.modal-body p {
  font-size: 18px;
  color: #555;
  margin: 0 0 15px 0;
}

.modal-body .text-warning {
  font-size: 18px;
  margin: 0;
  text-align: center;
}

.modal-footer {
  padding: 20px 25px;
  border-top: 2px solid #f0f0f0;
  display: flex;
  justify-content: flex-end;
  gap: 15px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  min-width: 120px;
}

.btn i {
  margin-right: 8px;
}

.btn-warning {
  background-color: #f39c12;
  color: white;
}

.btn-warning:hover {
  background-color: #e67e22;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-outline {
  background-color: #ffffff;
  color: #777;
  border: 2px solid #ddd;
}

.btn-outline:hover {
  background-color: #f0f0f0;
  border-color: #ccc;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .modal-content {
    margin: 10px;
  }
  
  .modal-header {
    padding: 20px 15px;
  }
  
  .modal-title {
    font-size: 20px;
  }
  
  .modal-body {
    padding: 20px 15px;
  }
  
  .modal-body p {
    font-size: 16px;
  }
  
  .modal-footer {
    flex-direction: column;
  }
  
  .modal-footer .btn {
    width: 100%;
  }
}
</style>